package com.rico.deploy.service.impl;

import com.github.pagehelper.PageHelper;
import com.rico.deploy.entity.Term;
import com.rico.deploy.mapper.TermMapper;
import com.rico.deploy.service.TermService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 夏智力
 * @FileName TermServiceImpl
 * @date 2021/5/2 17:53
 * @Software: IntelliJ IDEA
 */
@Service
public class TermServiceImpl implements TermService {
    @Autowired
    private TermMapper termMapper;

    @Override
    public List<Term> selectAll(Integer page,Integer limit) {
        PageHelper.startPage(page,limit);
        return termMapper.selectAll();
    }

    @Override
    public Term selectById(Integer id) {
        return termMapper.selectByPrimaryKey(id);
    }

    @Override
    public int insertTerm(Term term) {
        return termMapper.insert(term);
    }

    @Override
    public int deleteTermById(Integer id) {
        return termMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int updateTerm(Term term) {
        return termMapper.updateByPrimaryKey(term);
    }
}
